<?php
namespace app\controller\model;

use app\BaseController;
class Sign extends BaseController
{
    public $mobile="";
    public function __construct(){

    }
	public function mkSign($arr=[]){
		return $this->getSign($arr);
	}
	protected function getSign($arr=[]){
		if(isset($arr['timestamp'])) $arr['timestamp']=microtime();
		if(isset($arr['app_key'])) $arr['app_key']=$this->appKey;
		$str = $this->mkStr($arr);
		return $this->secret.$str.$this->secret;
	}
	protected function mkStr($arr=[]){
		$str='';
		$arr = $this->arrSort($arr);
		foreach ($arr as $k=>$v){
			$str .= $k.$v;
		}
		return $str;
	}
	protected function arrSort($arr=[]){
		return sort($arr);
	}
}
?>